/*
 * GrapRenderer
 * Version: 0.1
 * Date: 2008-03-01
 * Author: gp08-nhn
 */

package keyboardhero;

import java.awt.*;
import java.util.*;
import keyboardhero.Graphs.*;
import keyboardhero.MidiSequencer.*;

/**
 * Abstract interface for a GraphRender used by the {@link Graphs}. The interface contains the
 * methods that is required for a GraphRender. These include drawing functions, event handling
 * functions when a setting or state changed.
 * 
 * @author gp08-nhn
 */
interface GraphRenderer {
	
	// ××××× DRAWING FUNCTIONS ×××××
	
	/**
	 * Method for drawing the background of the central panel.
	 * 
	 * @param g
	 *            the Graphics context to which to draw the background.
	 * 
	 * 
	 */
	void drawBackground(Graphics g);
	
	/**
	 * Draws the screen which should be applied instead of the notes when the game is paused.
	 * 
	 * @param g
	 *            the Graphics context to which to draw the background.
	 * 
	 * 
	 */
	void drawPausedScreen(Graphics g);
	
	/**
	 * Method for drawing the top of the central zone of display.
	 * 
	 * @param g
	 *            the Graphics context.
	 * @param state
	 *            the state of the game.
	 * 
	 */
	void drawTop(Graphics g, Game.State state);
	
	/**
	 * Method for drawing a note.
	 * 
	 * @param g
	 *            the Graphics context where the note should be drawn.
	 * @param state
	 *            the state of the game.
	 * @param note
	 *            the note to be drawn.
	 */
	
	void drawNote(Graphics g, Game.State state, MidiSequencer.Note note);
	
	/**
	 * Method for drawing feedback messages about the score.
	 * 
	 * @param g
	 *            the Graphics context where to draw the messages.
	 * @param messages
	 *            a sorted set of messages to be drawn.
	 */
	void drawScoreMessages(Graphics g, SortedSet<ScoreMessage> messages);
	
	/**
	 * Method for drawing a keyboard according to the first and last key pressed by the user.
	 * 
	 * @param g
	 *            the Graphics context where to draw the keyboard.
	 * @param pressedKeys
	 *            the list of the keys that are currently hold down, organized by channel.
	 */
	
	void drawKeyboard(Graphics g, SortedMap<Integer, SortedMap<Integer, SortedSet<Key>>> pressedKeys);
	
	void activateKey(Key key);
	
	void deactivateKey(Key key);
	
	// ××××× EVENT FUNCTIONS : GENERAL ×××××
	
	void repaint();
	
	// ××××× EVENT FUNCTIONS : SETTINGS CHANGED ×××××
	
	void keysChanged();
	
	void lettersChanged();
	
	void keyboardStateChanged();
	
	void updateTexts();
	
	void updateTheme();
	
	// ××××× EVENT FUNCTIONS : STATES CHANGED ×××××
	
	void gameStarted();
	
	void gameEnded();
	
	void gamePaused();
	
	void gameResumed();
	
	void fullScreenStateChanged(boolean fullScreen);
	
	void setFullscreenChangeAllowed(boolean allowed);
	
	// ××××× PROVIDING FUNCTIONS ×××××
	
	int getKeyX(Key key);
	
	int getScaledKeyX(Key key);
	
	int getMiddleTop();
	
	int getMiddleBottom();
	
} // end class
